package cn.edu.scau.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.scau.dao.NursingRecordMapper;
import cn.edu.scau.entity.NursingRecord;
import cn.edu.scau.entity.NursingRecordShow;
import cn.edu.scau.service.NursingRecordService;

@Service
public class NursingRecordServiceImpl implements NursingRecordService {
	@Autowired
	private NursingRecordMapper nursingRecordMapper;
	
	@Override
	public boolean insert(NursingRecord nursingRecord) {
		//业务逻辑判断
		int line = nursingRecordMapper.insertSelective(nursingRecord);
		return line == 1 ? true:false;
	}

	@Override
	public boolean update(NursingRecord nursingRecord) {
		//业务逻辑判断
		int line = nursingRecordMapper.updateByPrimaryKeySelective(nursingRecord);
		return line == 1 ? true:false;
	}

	@Override
	public boolean delete(Integer id) {
		//业务逻辑判断
		int line = nursingRecordMapper.deleteByPrimaryKey(id);
		return line == 1 ? true:false;
	}

	@Override
	public NursingRecord selectById(Integer id) {
		//业务逻辑判断
		return nursingRecordMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<NursingRecordShow> selectAll() {
		return nursingRecordMapper.selectAll();
	}

	@Override
	public List<NursingRecordShow> findByPeriod(Date preTime, Date nextTime) {
		return nursingRecordMapper.findByPeriod(preTime, nextTime);
	}

}
